<?php
echo "<script>alert('个人会员暂停注册');location='index.php'</script>";
include("../inc/global.inc");
if($_POST[act]){
   if($_SESSION['chkCode']==$_POST['c_code']){
       if($_POST[c_provinces]&&$_POST[c_city]){
	    $c_rs=@mysql_query("select * from city where id='$_POST[c_provinces]' and city_id=0");
		$c_row=@mysql_fetch_array($c_rs);
		$c_rs2=@mysql_query("select * from city where id='$_POST[c_city]' and city_id>0");
		$c_row2=@mysql_fetch_array($c_rs2);
		$c_rs3=@mysql_query("select * from city where id='$_POST[c_diqu]' and city_id>0");
		$c_row3=@mysql_fetch_array($c_rs3);
	    
		$psw=substr(md5($_POST[m_password]),7,19);
		$tel=$_POST[phone_country]."-".$_POST[phone_area]."-".$_POST[phone_number];
		$ip=$_SERVER["REMOTE_ADDR"];
		
		
        @mysql_query("insert into member (m_mode,m_type,m_user,m_psw,m_name,m_sex,m_email,m_pro,pro,m_city,city,m_diqu,diqu,m_addre,m_tel,m_phone,m_qq,m_addtime,m_endtime,m_ip) values ('$_POST[m_mode]','$_POST[m_types]','$_POST[m_userid]','$psw','$_POST[m_people]','$_POST[m_sex]','$_POST[m_email]','$_POST[c_provinces]','$c_row[city_name]','$_POST[c_city]','$c_row2[city_name]','$_POST[c_diqu]','$c_row3[city_name]','$_POST[m_addre]','$tel','$_POST[m_mobile]','$_POST[m_qq]','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','$ip')");
		
		  
          echo "<script>alert('注册成功，请登录');location='/login/';</script>";
		
		}else{
		
		echo "<script>alert('请选择省份和城市');location='javascript:history.go(-1)';</script>";
		}

    }else{
       echo "<script>alert('验证码错误');location='javascript:history.go(-1)';</script>";
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人会员注册-三帝贸易网</title>
<link href="/css/body.css" rel="stylesheet" type="text/css" />
<link href="/css/head_2.css" rel="stylesheet" type="text/css" />
<link href="/css/foot.css" rel="stylesheet" type="text/css" />
<link href="css/join.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/join.js" type="text/javascript" charset="gb2312"></script>
<script language="javascript" src="/js/city.js" type="text/javascript" charset="gb2312"></script>
</head>
<body>
<?php include("../inc/head_top.php")?>
<div class="top1 topside6">
<div style="float:left;width:388px;"><a href="/"><img src="/images/logo.gif" border="0"/></a></div>
<div class="onl"></div>
</div>
<div class="onl"></div>
<form method="post" action="" onsubmit="return checkform()" name="form1">
<input type="hidden" name="m_types" value="3" />
<input type="hidden" name="m_mode" value="2" />
<div id="mian" class="topside6 sideyellow1">
<div class="title3 size12">尊敬的新会员您好，欢迎您注册三帝贸易网！ 客服热线:0551-7115928
  <div class="onl"></div>
</div>
<div class="content size14">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="50%" valign="top" bgcolor="#F4F4F0" style="line-height:20px; padding-left:15px;"><strong>企业会员注册：</strong><br />
        1.免费注册；2.免费发布信息；3.发布招聘信息。<br />
        4.查看招标信息；5.下载三帝资料；6.建立自己的企业商铺。<br />
        7.上传公司证件。</td>
      <td width="50%" valign="top" bgcolor="#F4F4F0" style="line-height:20px;"><strong>个人会员注册：</strong><br />
        1.下载三帝资料，<br />
        2.查看招标信息，<br />
        3.求职。 </td>
    </tr>
  </table>
  <table width="100%" height="112" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td width="20%" height="28" align="right" bgcolor="#F4F4F0">注册会员类型<span class="fontred"> *</span></td>
        <td height="28" colspan="2" bgcolor="#F4F4F0" class="size14"><a href="index.php"><input type="radio" onClick="window.open('index.php','_self')"/>企业会员注册</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="personal.php"><input type="radio" checked="checked" onClick="window.open('personal.php','_self')"/>个人会员注册</a></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" >会员登录名<span class="fontred"> * </span></td>
        <td width="42%" height="28" ><input name="m_userid" type="text" class="input1" id="m_userid" size="35" maxlength="40" onChange="callServer();"/>&nbsp;<span id="test1"></span></td>
        <td width="38%" ><div class="txt">会员登录名由6-20个英文字母或数字组成(不支持中文)。一旦注册成功，不可修改。</div></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" bgcolor="#F4F4F0" >密　　码<span class="fontred"> *</span></td>
        <td width="42%" height="28" bgcolor="#F4F4F0">
		<input name="m_password" type="password" class="input1" id="m_password" size="35" maxlength="40" /></td>
        <td width="38%" height="28" bgcolor="#F4F4F0"><div class="txt">密码由6以上字符组成，建议采用易记、难猜的英文数字组合。</div></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" >确认密码<span class="fontred"> *</span></td>
        <td width="42%" height="28" ><input name="m_password2" type="password" class="input1" id="m_password2" size="35" maxlength="40" /></td>
        <td width="38%" height="28" ><div class="txt">请再输入一遍您上面填写的密码。</div></td>
      </tr>
    </tbody>
  </table>
  <div class="title2 b">姓名和联系方式</div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">真实姓名</span><span class="fontred"> *</span></td>
        <td width="42%" bgcolor="#F4F4F0"><input name="m_people" class="input1" id="m_people" size="35" /></td>
        <td width="38%" bgcolor="#F4F4F0"><div class="txt">请输入全名</div></td>
      </tr>
      <tr>
        <td width="20%" align="right" ><span class="text">称呼</span><span class="fontred"> *</span></td>
        <td colspan="2" >
		 <input id="m_sex" name="m_sex" type="radio" value="先生" checked="checked"> 先生
		 <input id="m_sex" name="m_sex" type="radio" value="女士"> 女士
		 <input id="m_sex" name="m_sex" type="radio" value="小姐"> 小姐</td>
      </tr>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">电子邮箱<span class="fontred"> *</span></span></td>
        <td bgcolor="#F4F4F0" ><input name="m_email" class="input" id="m_email" size="35" /></td>
        <td bgcolor="#F4F4F0" ><div class="txt">非常重要！</div></td>
      </tr>
      <tr>
        <td align="right" ><span class="text">公司所在地</span><span class="fontred"> *</span></td>
        <td colspan="2" >
		<select  name="c_provinces" id="c_provinces" onChange="changelocation(document.form1.c_provinces.options[document.form1.c_provinces.selectedIndex].value)">
            <option value="">--选择省份--</option>
          <?php
          $result = mysql_query("select * from city where city_id=0");    
          while($res = mysql_fetch_array($result)){    
          ?>    
          <option value="<?=$res['id']?>"><?=$res['city_name']?></option> 
          <?php }?>   
       </select>
       <select name="c_city" id="c_city">
            <option value="">--选择城市--</option>
       </select><select name="c_diqu" id="c_diqu">
            <option value="">--选择地区--</option>
       </select></td>
        </tr>
	  <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">联系地址</span><span class="fontred"> *</span></td>
        <td colspan="2" bgcolor="#F4F4F0" ><input name="m_addre" id="m_addre" type="text" class="input" maxlength="100"/></td>
      </tr>
      <tr>
        <td width="20%" align="right" ><span class="text">固定电话</span></td>
        <td colspan="2">国家区号&nbsp;区号&nbsp; 电话号码<br />
          <input class="input2" id="phone_country" maxLength="8" size="5" value="86" name="phone_country"> 
            <input class="input2" id="phone_area" maxLength="8" size="5" name="phone_area"> 
            <input class="input1" id="phone_number" maxLength="100" size="17" name="phone_number"></td>
      </tr>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">手机<span class="fontred"> *</span></span></td>
        <td bgcolor="#F4F4F0" ><input name="m_mobile" class="input" id="m_mobile" size="35" /></td>
        <td bgcolor="#F4F4F0" >&nbsp;</td>
      </tr>
      <tr>
        <td width="20%" align="right" ><span class="text">即时通&nbsp;&nbsp;</span></td>
        <td ><input name="m_qq" class="input" id="m_qq" size="35" /></td>
        <td ><div class="txt">MSN或QQ</div></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#F4F4F0" >验证码<span class="fontred"> *</span></td>
        <td colspan="2" bgcolor="#F4F4F0" ><input name="c_code" class="input2" id="c_code" size="8" maxlength="6" />&nbsp;<img src="/inc/chk_num.php" align="absmiddle" id="img"/>&nbsp;<a href="#" name="test" id="test">看不清楚？</a></td>
        </tr>
    </tbody>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td colspan="3" align="center" ><div class="content">  <span class="fontgreen"><a 
class="news_trade" href="/about/" 
target="_blank">点此阅读三帝贸易网会员服务条款</a></span><br />
          <input type="hidden" name="act" value="sandib2b.cn" />
                <input name="Submit" type="submit" class="inputbutt" value="同意服务条款，提交注册信息" />
                <br /><span class="fontgray">如果您不能正常注册，请点此下载文档，我们帮您注册。</span><br />
        </div></td>
      </tr>
    </tbody>
  </table>
</div></div></form>
<div id="foot" class="footside">
<?php include("../inc/foot.php");?>
</div>
</body>
</html>

<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){

 if($("m_userid").value.length>50||$("m_userid").value.length<6){
    alert("请按照要求输入会员登录名");
    $("m_userid").focus();
    return false;
 }
 
 
if($("m_userid").value!="")
 	 {
 	  	var temp = unisch($("m_userid").value)
		if(temp==true)
		{
		    alert("请按照要求输入会员登录名");
			$("m_userid").focus();
			return false;
		}
 	 }

	 
 if($("m_password").value.length<6){
    alert("请输入密码");
    $("m_password").focus();
    return false;
 }

if($("m_password2").value!=$("m_password").value){
alert("您两次输入的密码不一致");
$("m_password2").focus();
return false;
}


if($("m_people").value==""){
alert("请输入您的真实姓名");
$("m_people").focus();
return false;
}

var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
　　　　if(!pattern.test($("m_email").value)){
			alert("请输入您的E-mail地址");
			$("m_email").focus();
			return false;
		}


if($("c_provinces").value==""){
alert("请选择您的省份");
$("c_provinces").focus();
return false;
}

if($("c_city").value==""){
alert("请选择您的城市");
$("c_city").focus();
return false;
}

if($("m_addre").value==""){
alert("请输入联系地址");
$("m_addre").focus();
return false;
}

if($("m_mobile").value==""){
alert("请输入手机号码");
$("m_mobile").focus();
return false;
}

if($("c_code").value.length!=6){
  alert("请输入您的验证码");
  $("c_code").focus();
  return false;
}

}

function unisch(String) 
{ 
	var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; 
	var i; 
	var c; 
	for( i = 0; i < String.length; i ++ ) 
	{ 
		c = String.charAt( i ); 
		if (Letters.indexOf( c ) ==-1) 
		{ 
			return true; 
		} 
	} 
	return false; 
} 

function test(img){
    var src=img.getAttribute("src");
    src=src+"?new="+Math.random(0,10);
    img.setAttribute("src",src);
}
function prepare(){
    var nav=document.getElementById("test");
    var name=nav.getAttribute("name");
    var str="test";
    if(name==str){
        nav.onclick=function(){
            var img=document.getElementById("img");
            test(img);
            return false;
        }
    }
}
window.onload=prepare;
</script>